//
//  AYBLEDeviceType.h
//  FuweiCloud
//
//  Created by michael on 2024/8/12.
//
#import <Foundation/Foundation.h>

//蓝牙设备状态改变通知
static NSNotificationName bleCentralStateDidUpdateNotification = @"aybleCentralStateDidUpdateNotification";

//外设搜索回调通知
static NSNotificationName blePeripheralDiscoverNotification = @"ayblePeripheralDiscoverNotification";

//外设连接通知
static NSNotificationName blePeripheralConnectedNotification = @"ayblePeripheralConnectedNotification";

//外设断开连接通知
static NSNotificationName blePeripheralDisconnectNotification = @"ayblePeripheralDisconnectNotification";

//收到指令响应通知
static NSNotificationName bleReceivedCommandDataNotification = @"aybleReceivedCommandDataNotification";


///< 蓝牙设备配网参数
typedef NS_ENUM(NSInteger, AYBLEDeviceMatchType) {
    AYBLEDeviceMatchTypeQ0 = 0,
    AYBLEDeviceMatchTypeQ1 = 1,
    AYBLEDeviceMatchTypeA4 = 2,
};


typedef NS_ENUM(int8_t, AYBLEDeviceConnectStatus) {
    AYBLEDeviceConnectStatus_Success = 0,
    AYBLEDeviceConnectStatus_Failure = -100,
    AYBLEDeviceConnectStatus_Timeout = -101,
};

///蓝牙指令
typedef NS_ENUM(NSInteger, AYBLECommandType) {
    AYBLECommandType_ConnnectState = 0x10011, ///< 自定义指令，连接状态
    AYBLECommandType_NetConfig = 0x1001,     /// 配网
    AYBLECommandType_NetResult = 0x1010,     /// 配网结果返回
    AYBLECommandType_RemoteUnlock = 0x8001, ///< 远程开锁
    AYBLECommandType_RemoteLock = 0x8002, ///< 远程关锁
    AYBLECommandType_RandomCode = 0x8003, ///< 随机码
    AYBLECommandType_PasswordAdd = 0x8015, ///< 添加密码
    AYBLECommandType_PasswordDelete = 0x8016, ///< 删除密码
    AYBLECommandType_PasswordList = 0x8017, ///< 密码列表
    AYBLECommandType_AdminPasswordSet = 0x8018, ///< 设置管理员密码
    AYBLECommandType_AdminPasswordGet = 0x8019, ///< 获取管理员密码
    AYBLECommandType_ReportUnlock = 0x8050, ///< 开锁事件上报 *
    AYBLECommandType_ReportLock = 0x8051, ///< 关锁上报
    AYBLECommandType_ReportLowPower = 0x8052, ///< 低电量上报
    AYBLECommandType_ReportUnlockException = 0x8054, ///< 开锁异常上报
    AYBLECommandType_ReportPwdAddition = 0x8055, ///< 密码添加上报
    AYBLECommandType_ReportPwdDeletion = 0x8056, ///< 密码删除上报
    AYBLECommandType_ReportTrialError = 0x8057, ///< 试错报警上报
    AYBLECommandType_ReportDoorOpened = 0x8058, ///< 门未关上报
    AYBLECommandType_ReportMultiLock = 0x8061, ///< 批量开、关锁事件上报
    AYBLECommandType_ReportMultiAlarm = 0x8062, ///<批量警报事件上报
    AYBLECommandType_AutoReplySet = 0x805A, ///< 自动回复设置
    AYBLECommandType_AutoReplyGet = 0x805B, ///< 自动回复获取
    AYBLECommandType_Power = 0x8064, ///< 获取电量
    AYBLECommandType_LockVolumeSet = 0x8067, ///< 设置门锁音量
    AYBLECommandType_LockVolumeGet = 0x8068, ///< 获取门锁音量
    AYBLECommandType_LockVerion = 0x8070, ///< 获取门锁版本信息
    AYBLECommandType_AutoLockSet = 0x8095, ///< 设置自动闭锁
    AYBLECommandType_AutoLockGet = 0x8096, ///< 获取自动闭锁
    AYBLECommandType_LockState = 0x80A5, ///< 获取门锁状态
    AYBLECommandType_LockAllAttr = 0x80B0, ///< 获取门锁所有属性(不包含密码列表信息)
    ///< ==================================9xxx系列
    AYBLECommandType_NetDiagnostic = 0x9010,       ///< 网络诊断
    AYBLECommandType_FingerprintAdd = 0x9020,      ///< 添加指纹
    AYBLECommandType_FingerprintDelete = 0x9021,   ///< 删除指纹
    AYBLECommandType_FingerprintCancel = 0x9022,   ///< 取消指纹录入
    AYBLECommandType_FingerprintProgress = 0x9023,  ///< 指纹录入进度
    AYBLECommandType_SyncTime = 0x9040, ///< 同步网络时间
    AYBLECommandType_NFCAdd = 0x9050, ///< NFC读取
    AYBLECommandType_NFCCancel = 0x9051, ///< NFC取消录入
    AYBLECommandType_NFCAddResult = 0x9052, ///< NFC添加结果
    AYBLECommandType_PalmAdd = 0x9054, ///< 掌静脉
    AYBLECommandType_PalmAddResult = 0x9055, ///< 掌静脉添加结果
    AYBLECommandType_BindDevice = 0x9060, ///< 绑定设备
    AYBLECommandType_UnbindDevice = 0x9061, ///< 解绑设备
    AYBLECommandType_SecretCheck = 0x9062, ///< 密钥校验
    AYBLECommandType_LockProductInfo = 0x8071, ///< 锁的产品信息
    AYBLECommandType_OTARequest = 0xC010, ///< OTA升级前准备
    AYBLECommandType_OTAFileInfo = 0xC011, ///< OTA文件信息
    AYBLECommandType_OTAFileOffset = 0xC012, ///< OTA文件偏移
    AYBLECommandType_OTAFileData = 0xC013, ///< OTA文件数据
    AYBLECommandType_OTAFinished = 0xC014, ///< OTA升级结束
    AYBLECommandType_AccessoryMatch = 0x9063, ///< 配件配对
    AYBLECommandType_AccessoryMatchResult = 0x9064, ///< 配件配对结果上报
    AYBLECommandType_EmergencyUnlock = 0x9065, ///< 紧急开锁
    AYBLECommandType_AdjustLock = 0x9066, ///< 门锁校准
    AYBLECommandType_DoorState = 0x9067, ///< 获取门和锁的状态
    AYBLECommandType_VendorSN = 0x9068, ///< 第三方的SN信息（比如 homekit sn信息）
};
